<?php
/**
 * Lang.php                 语言包管理控制器
 *
 * @author                  mashanling <msl-138@163.com>
 * @date                    2012-07-03 17:34:29
 * @lastmodify             2012-12-29 17:07:24 by mashanling
 */

class LangController extends BaseController {
    protected $_init_model = false;//是否实例对应模型

    /**
     * 生成语言包js
     *
     * @author          mashanling
     * @date            2012-07-04 08:35:38
     * @lastmodify     2012-12-29 17:07:40 by mashanling
     *
     * @return void 无返回值
     */
    public function createAction() {
        require(LIB_PATH . 'functions/dir.php');
        create_dir(WEB_LANG_PATH);
        $lang_arr = scand_dir(LANG_PATH);//语言包

        foreach ($lang_arr as $k => $v) {
            $lang     = is_file($filename = SYS_LANG_PATH . $k . '.php') ? include($filename) : array();

            foreach ($v as $file) {
                $lang = array_merge($lang, array_change_key_case(include($file), CASE_UPPER));
            }

            array2js($lang, 'L', WEB_LANG_PATH . $k . '.js');
        }
    }
}